/*
 * Copyright 2014 Semidata. All rights reserved.
 */
package com.semidata.rtd.engine.main;

import java.util.Random;

import com.semidata.rtd.engine.job.Job;
import com.semidata.rtd.engine.job.SyncTask;

/**
 * @author shewei@semidata.com, She Wei
 * 
 */
public class TestTask3 extends SyncTask {

	public TestTask3(Job job, int timeout) {
		super(job, timeout);
	}

	@Override
	public void run() throws InterruptedException {
		// int sum = 0;
		// Random rand = new Random();
		// for (int i = 0; i < 1000; i++) {
		// sum += rand.nextDouble() * 100 - 50;
		// }
		//
		// if (sum > 0)
		// sum = 1;
		// else if (sum < 0)
		// sum = -1;
		// else
		// sum = 0;

		// System.out.println("test3");

		Random rand = new Random();
		double r = rand.nextDouble();
		if (r < 0.01) {
			while (true) {

			}
		} else if (r < 0.1) {
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				throw e;
			}
		}

	}
}